(define (make-point x y)
    (cons x y)    
)
(define (x-point p)
    (car p)
)
(define (y-point p)
    (cdr p)
)
(define (print-point p)
    (newline)
    (display "(")
    (display (x-point p))
    (display ",")
    (display (y-point p))
    (display ")")
)

(define (make-segment p1 p2)
    (cons p1 p2)
)

(define (start-segment s)
    (car s)
)
(define (end-segment s)
    (cdr s)
)
(define (midpoint-segment s)
    (let(
            (ss (start-segment s))
            (es (end-segment s))
        )
        (make-point 
            (/ (+ (x-point ss) (x-point es)) 2)
            (/ (+ (y-point ss) (y-point es)) 2)            
        )
    )    
)
(print-point 
    (midpoint-segment 
        (make-segment
            (make-point 0 1)
            (make-point 2 3)
        )
    )
)
(exit)        